package org.example.email.contorller;

import org.example.email.service.IEmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: EmailContorller
 * @author: e
 * @createDate: 2021/5/30
 */
@RequestMapping("/email")
@RestController
public class EmailContorller {

    @Autowired
    private IEmailService emailService;

    /***
     * 生成验证码并发送到对应邮箱，成功true，失败false
     **/
    @GetMapping("/{email}/{code}")
    public boolean sendCode(@PathVariable("email") String email,@PathVariable("code") String code) {
        return emailService.sendEmail(email,code);
    }


}
